<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
    <h1>axios请求方法别名</h1>
    <button id="btnGet">发送查询get请求</button>
    <button id="btnPost">发送新增post请求</button>
    <button id="btnUpdate">发送更新update请求</button>
    <button id="btnDelete">发送删除delete请求</button>
    <script>
        const btnGet=document.getElementById('btnGet')
        const btnPost=document.getElementById('btnPost')
        const btnUpdate=document.getElementById('btnUpdate')
        const btnDelete=document.getElementById('btnDelete')
        btnGet.onclick=async function(){
         const re= await axios.get('/getuser',{params:{userID:1}})
         console.log(re);
        }
        btnPost.onclick=async function(){
         const re= await axios.get('/adduser',{name:'魈',age:18,sex:'男'})
         console.log(re);
        }
        btnPut.onclick=async function(){
         const re= await axios.get('/updateuser',{userID:1,name:'钟离',age:18,sex:'男'})
         console.log(re);
        } 
        btnDelete.onclick=async function(){
         const re= await axios.get('/getuser',{params:{userID:1}})
         console.log(re);
        }

    </script>
</body>
</html>